/**
 * 
 */

$(function(){
		$("input[type=checkbox]").attr("class","checkitem");
		$("table>tbody>tr:even").css("background", "#fff");
		$("table>thead>tr").css("background", "#f1f1f1");
		$("table>tbody>tr:odd").css("background", "#f9f9f9");
})
	

function checkAll(el){
	var items=document.querySelectorAll(".item");
	for (var i = 0; i < items.length; i++) {
		items[i].checked=el.checked;
	}
}

function upload(){
	var formData=new FormData($('#uploadForm')[0]);
	$.ajax({
		url:'/up',
		type:'post',
		cache:false,
		async:false,
		contentType:false,
		processData:false,
		success:function(returndata){
			alert(returndata);
		},
		error:function(returndata){
			alert(returndata);
		}
	});
}
//将date类型转换成timestamp类型
function timeStamp2String (time){
    var datetime = new Date();
     datetime.setTime(time);
     var year = datetime.getFullYear();
     var month = datetime.getMonth() + 1;
     var date = datetime.getDate();
     var hour = datetime.getHours();
     var minute = datetime.getMinutes();
     var second = datetime.getSeconds();
     var mseconds = datetime.getMilliseconds();
     return year + "-" + month + "-" + date+" "+hour+":"+minute+":"+second+"."+mseconds;
};
function msgbox1(n){
	document.getElementById('inputbox1').style.display=n?'block':'none';
}
function msgbox1(n,e){
	document.getElementById('inputbox1').style.display=n?'block':'none';      
    $.get("Ziliaomodify",function(data){
		$.each(data,function(i,item){
    	if(e.id==data[i].uid){
    	$("#r1").attr("placeholder",data[i].uname);
    	$("#r2").attr("placeholder",data[i].utel);
    	$("#r3").attr("placeholder",data[i].uemail);
    	$("#r4").attr("value",data[i].uid);
    	}
    	});
    	});
    document.getElementById('temp').style.display=n?'block':'none';
    
    
}
	
	 function msgbox2(n){
		    document.getElementById('inputbox2').style.display=n?'block':'none';     /* 点击按钮打开/关闭 对话框 */
		    document.getElementById('temp').style.display=n?'block':'none';
	 }
	
	 function msgbox3(n){
		    document.getElementById('inputbox3').style.display=n?'block':'none';     /* 点击按钮打开/关闭 对话框 */
		    document.getElementById('temp').style.display=n?'block':'none';
		    
		}
	
	 function msgbox4(n,e2){
			document.getElementById('inputbox4').style.display=n?'block':'none';
		    $.get("consumerecord",function(data2){
		    	$(".tab").html("");
		    		$(".tab").append("<tr><td>"+"消费方向"+
		    				"</td><td>"+"消费金额"+
		    				"</td><td>"+"消费日期"+
	    					"</td><td>"+"消费操作人"+
	    					"</td><td>"+"消费操作人名称"+
	    					"</td></tr>");
		    	$.each(data2,function(i,item){
		    		if(e2.id==data2[i].uId){
		    		    		$(".tab").append(
		    		    					"<tr><td>"+data2[i].urWay+
		    			    				"</td><td>"+data2[i].urMoney+
		    			    				"</td><td>"+timeStamp2String(data2[i].urDate)+
		    			    				"</td><td>"+data2[i].urdoWay+
		    			    				"</td><td>"+data2[i].urName+
		    			    				"</td></tr>");
		    			    	}
		    		
		    		
		    		
			    	});
		    	});
		    document.getElementById('temp').style.display=n?'block':'none';
		    
		    /* 点击按钮打开/关闭 对话框 */
		   
		}
 
